/*
 *
 *  * Copyright (c) iwindplus Technologies Co., Ltd.2024-2030, All rights reserved.
 *
 *
 */

package com.iwindplus.base.rocket;

import com.iwindplus.base.rocket.domain.property.RocketProperty;
import com.iwindplus.base.rocket.service.RocketService;
import com.iwindplus.base.rocket.service.impl.RocketServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * RocketMq配置.
 *
 * @author zengdegui
 * @since 2020/4/28
 */
@Slf4j
@Configuration
@ConditionalOnProperty(prefix = "rocketmq.custom", name = "enabled", havingValue = "true", matchIfMissing = true)
@EnableConfigurationProperties(RocketProperty.class)
public class RocketConfiguration {

    /**
     * RocketService.
     *
     * @return RocketService
     */
    @Bean
    public RocketService<?> rocketService() {
        final RocketService rocketService = new RocketServiceImpl();
        log.info("RocketService={}", rocketService);
        return rocketService;
    }
}
